import pandas as pd
import matplotlib.pyplot as plt

%load_ext pretty_jupyter

Motivation

The motivation of this simple notebook is to perform test of the template generation for a basic report and show how it behaves in different situation.

For this purpose, we will attempt to use standard commands that are usually used throughout the report and work with them.

Data

We try a document on an example of dataset countries. The dataset has two columns: Country and Region. Country is name of the country and Region is its corresponding continent.

data = pd.read_csv("https://raw.githubusercontent.com/cs109/2014_data/master/countries.csv")
data.head()
Country Region
0 Algeria AFRICA
1 Angola AFRICA
2 Benin AFRICA
3 Botswana AFRICA
4 Burkina AFRICA

Region

fig, ax = plt.subplots()

vc = data["Region"].value_counts()
ax.bar(vc.index, vc.values)
ax.set(title="The number of countries for each region", xlabel="Region", ylabel="Total countries")
ax.set_xticklabels(vc.index, rotation=30)
fig.show()

Country

Every country is unique in the dataset. Some examples:

data[["Country"]].head()
Country
0 Algeria
1 Angola
2 Benin
3 Botswana
4 Burkina
%%jinja markdown

There is the total of {{ data["Country"] | length }} countries.

There is the total of 194 countries.

Conclusion

We tested basic properties of the new Rmd template and it just seems to be amazing!